home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
pc_board
/
sms.zip
/
SMS.PPS
Wrap
Text File
|
1993-05-21
|
12KB
|
427 lines
; Logical Solutions' Simple Menu System "SMS"
; =============================================
; Programmed by Hans Hoogstraat FidoNet 134/10
;
; Intro:
; SMS present the user with a DOOR menu system
; and is very simple configurable by the SYSOP
;
; SMS checks ahead of time if a USER is allowed
; to enter a DOOR using his security level and
; custom tailors the presented MENU accordingly.
;
; SUBMENU's are supported and the MENU's are
; displayed regardless of the USER's Xpert flag.
;
; The USER makes his menu choices by either typing
; in a number or the NAME of the DOOR. He can type
; as few characters as required to satisfy a unique
; selection. If he selects a DOOR for which his
; access level is too low, a warning will be displayed
; and his selection is voided.
;
; Setup:
; First the difficult part.
;
; Prior to installation, SMS must be recompiled
; replacing the first FOPEN 1,filename by the
; proper setting for your system. Unfortunately
; PPLC doesn't seem to have any support to obtain
; this information from the CNAMES file.
;
; Create a directory, say "C:\PPS" and move the
; SMS.PPS and SMS.PPE files into this directory.
;
; Step 1: Now the easy part.
;
; SMS is driven from NAME.LST files in the same
; directory as used for the SMS.PPE file.
;
; Use any ASCII editor and create for example DOORS.LST
;
; CC 1 My example:
; |
;------------------------ Top --------------------------------------
; Main DOORS Menu
; CREDIT Online Credit Card Subscription.
; -
; MAIL Our popular MAIL .QWK reader.
; -
; PCBHELP Help with this BBS.
; -
; GAMES* Some 80 OnLine GAMES
; -
; Any DOOR or GAME on this BBS can be immediatly activated by
; typing the Name of the DOOR on the PcBoard MAIN command prompt.
;------------------------ Bottom --------------------------------------
;
; Line 1 = Menu Title
;
; Line 2 till End
;
; A DOOR is specified by name in CC1 followed by a description.
;
; A SubMenu is specified like a DOOR, but suffixed by an '*'
;
; A blank line is specified by a ' -' in CC1-2
;
; Anyline with ';' in CC1 is considered a comment and is skipped
; on the presented menu.
;
; Any other information, starting with a ' ' in CC1 is presented
; as a comment in the presented menu.
;
; Resulting Menu:
;
; ╔ ## Name ══════════════] DOORS - Main DOORS Menu [═══════════════════╗
; ║ 1 CREDIT Online Credit Card Subscription. ║
; ║ ║
; ║ 2 MAIL Our popular MAIL .QWK reader. ║
; ║ ║
; ║ 3 PCBHELP Help with this BBS. ║
; ║ ║
; ║ 4 GAMES Some 80 OnLine GAMES ║
; ║ ║
; ║ Any DOOR or GAME on this BBS can be immediatly activated by ║
; ║ typing the Name of the DOOR on the PcBoard MAIN command prompt. ║
; ╚═════════════════════════════════════════════════════════════════════╝
; Enter Selection (1-4,Name,A=Abort,Q=Quit) ? ( )
;
; The DOOR names GAMES* results in a SubMenu described in a simular
; file as DOORS.LST, but now called GAMES.LST. There is no limit
; to the number of SubMenu's.
;
; The user can type '2' or 'M' to activate the MAIL DOOR.
;
; An 'Q' response, redisplays the Parent Menu, if any.
;
; An 'A' response, just Abort the SMS.PPE and returns the user
; to whatever he was doing prior to the Menu.
;
; Step 2:
;
; The proper setup has to be included in the PcBoard CMD.LST file
; and my example follows:
;
; ╔════════════════════════════════════════════════════════════════
; ║ File Locations
; ║
; ║ Command Security PPE/MNU File -or- Keystroke Repla
; ║ ══════════════ ════════ ═════════════════════════════════
; ║ 1) CREDIT 10 CREDIT
; ║ 2) MAIL 10 MAIL
; ║ 3) DOORS 10 M:\PCB\PPS\SMS.PPE DOORS.LST
; ║ 4) OPEN 10 M:\PCB\PPS\SMS.PPE DOORS.LST
; ║ 5) GAMES 10 M:\PCB\PPS\SMS.PPE GAMES.LST
; ║
; ║ ESC=Exit Alt-R=Repeat a Line Alt-I=Insert a Line Alt-D=D
; ╚══ 14:41:30 ═══ 05-21-93 ══════ F1 ═ help ════ caps: OFF num: O
;
; Note that I repeated GAMES, so the user can Enter the GAMES Menu
; without going thru the DOORS menu
;
; Now if the SMS PPLC Compiled output would run faster than a 4.77Mhz
; PC, things would realy be great. I used the Beta PPLC for my tests.
;
; -------
;
; Enjoy:
;
; Regards,
;
; Hans Hoogstraat
;
string text
string opt_str
string option
integer option_no
string doors[16] ; Allows for 256 Door Entries
string door
integer door_sec
integer user_sec
string menu_name
string top_line
string bot_line
string mid_line
integer i
integer k
integer n
integer no_door_str
integer no_opt
integer menlen
integer textlen
integer optlen
integer prplen
boolean done
string C_BG ; Menu Background and Border Color
string C_OP ; Menu Name Options
string C_NM ; Menu Numerical Options
string C_DE ; Menu Option Description
string C_CM ; Menu Comment Lines
string C_IN ; Menu Input Prompt
string C_ER ; Menu Input Error
cls
; Define the Color Selections
C_BG = "@X1F" ; Intense White on Blue
C_OP = "@X1E"
C_NM = "@X1F"
C_DE = "@X1B"
C_CM = "@X1F"
C_IN = "@X0E"
C_ER = "@X0C"
; Get the User's Security Level
user_sec = cursec()
; Define Size of Menu Box
top_line = C_BG+"╔ ## Name ════════════════════════════════════════════════════════════════╗@X0F"
mid_line = C_BG+"║ ║@X0F"
bot_line = C_BG+"╚═════════════════════════════════════════════════════════════════════════╝@X0F"
menlen = len(top_line) - 8
; Read the Doors.Lst file, and build up strings in array DOORS
; Since the maximum is DOORNAME,,SSS, , we only need to save
; the first 15 characters. 256/15 = 16 entries per string
; Each entry is prefixed by a "|" character
; Tailer next command for your system, since PPLC has no command to
; find it.
fopen 1,"m:\pcb\gen\doors.lst",O_RD,S_DN ; <= Replace to tailor
done = false
no_door_str = 0
door = ""
i = 0
while (!done) do
fget 1,text
if (text == "") then ; Check if EOF reached.
done = true ; If so, flag that we are done
fclose 1 ; and close the input file.
if (door != "") then ; Save a possible last partly
inc no_door_str ; built door string
doors[no_door_str] = door
endif
endif
door = door + "|"+left(text,15) ; Concatenate this Entry
inc i ; Boost no of entries concatenated
if (i == 16) then ; If we have 16 entry concatenated,
inc no_door_str ; save the result and start a new
doors[no_door_str] = door ; string.
door = ""
i = 0
endif
endwhile ; Continue thru the DOORS.LST file
; Process the Menu input file
menu_name = gettoken()
:another_menu
cls
no_opt = 0
opt_str = ""
text = ppepath()+menu_name
fopen 1,text,O_RD,S_DN
fget 1,text
text = trim(text," ")
i = instr (menu_name,".")
if (i != 0) menu_name = left(menu_name,i-1)
text = "] " + C_OP + menu_name + C_BG + " - " + text + " ["
menlen = (menlen - len(text) + 8) / 2 + 4
text = left(top_line,menlen)+text+right(top_line,menlen)
menlen = len(text) - 16
println text
done = false
while (!done) do
fget 1,text
if (text == "") then
done = true
fclose 1
else
door = left(text,1)
if (door != ";") then
if (door == " ") then
if (left(text,2) == " -") text = ""
print left(mid_line,6)
print C_CM+text+C_BG
println right(mid_line,menlen-len(text)+2)
else
inc no_opt
text = trim(text," ")
textlen = len(text)
i = instr(text," ");
if (i == 0) i = textlen
option = upper(rtrim(left(text,i)," "))
opt_str = opt_str+"|"+option
door = rtrim(option,"*")
if (door != option) then
option = door
optlen = len(option)
text = ltrim(right(text,textlen-i)," ")
door = ",0"
goto found_door
endif
optlen = len(option)
text = ltrim(right(text,textlen-i)," ")
door = ",255"
for k = 1 to no_door_str
n = instr(doors[k],"|"+option)
if (n != 0) then
door = rtrim(mid(doors[k],n+optlen+2,3),",")
goto found_door
endif
next
:found_door
door_sec = s2i(trim(door,","),10)
opt_str = opt_str+door
print left(mid_line,6)+C_NM
if (user_sec >= door_sec) then
print right(" "+string(no_opt),2)
print " "+C_OP
else
print " "+C_DE
endif
print left(option+" ",8)+" "
print C_DE+text+C_BG
println right(mid_line,menlen-len(text)-10)
endif
endif
endif
endwhile
inc no_opt
opt_str = opt_str + "|"
optlen = len(opt_str)
text = left(bot_line,6)+right(bot_line,menlen+2)
println text
done = false
while (!done) do
backup 80
clreol
backup 80
text =""
inputtext C_IN+" Enter Selection (1-"+string(no_opt-1)+",Name,A=Abort,Q=Quit) ",text,15,8
text = upper(strip(text," "))
if (text == "Q") then
pop menu_name
if (menu_name != "") goto another_menu
stop
endif
if (text == "A") stop
option_no = s2i(text,10)
if (option_no >= 1 && option_no < no_opt && string(option_no) == text) then
text = opt_str
for i = 1 to option_no
text = mid(text,instr(text,"|")+1,optlen)
next
text = left(text,instr(text,"|")-1)
endif
i = instr (opt_str,"|"+text)
if (i > 0 && instr(mid(opt_str,i+1,optlen),"|"+text) == 0) then
text = mid(opt_str,i+1,optlen)
i = instr(text,",")
door = left(text,i-1)
door_sec = s2i(trim(mid(text,i+1,3),","),10)
if (user_sec >= door_sec) then
done = true
else
backup 80
text=""
inputtext C_IN+" Your access level is too low for ("+C_ER+door+C_IN+") ",text,15,1
endif
endif
endwhile
i = instr(door,"*")
if (i == 0) then
fcreate 1,"pcbstuff.kbd",O_WR,S_DB
fput 1,menu_name
fclose 1
kbdstuff door
else
push menu_name+".LST"
menu_name = left(door,i-1)+".LST"
goto another_menu
endif